package com.syllabus.servlet;

import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.db.DatabaseHelper;

public class GetSemServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;
/*	private static Map<String, String[]> m = new HashMap<String, String[]>();

	static {
		m.put("I", new String[] { "01", "02" });
		m.put("II", new String[] { "03", "04" });
		m.put("III", new String[] { "05", "06" });
		m.put("IV", new String[] { "07", "08" });

	}*/

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		String year = request.getParameter("year");
		response.setContentType("text/plain");
		String value = null;
		try {
			value = DatabaseHelper.getSemesters(year).toString();
		} catch (Exception e) {
			e.printStackTrace();
		}
		response.getWriter().write(value.substring(1, value.length() - 1));
	}

}
